﻿using System;
using System.Collections;
using System.Text;

namespace CSharp进阶_Queue
{
	class Test { }
	abstract class Monster
	{
		public static ArrayList monsters = new ArrayList();
		public Monster()
		{
			monsters.Add(this);
		}
		abstract public void Atk();
	}
	class Boss : Monster
	{
		public override void Atk()
		{
			Console.WriteLine("boss atk");
		}
	}
	class Goblin : Monster
	{
		public override void Atk()
		{
			Console.WriteLine("goblin atk");
		}
	}
	class Program
	{
		static void Main(string[] args)
		{
			//Queue q = new Queue();
			//#region 增
			//q.Enqueue(1);
			//q.Enqueue(3.144f);
			//q.Enqueue("miku");
			//q.Enqueue(new Test());
			//#endregion
			//#region 取
			//q.Dequeue();
			//float s = (float)q.Peek();
			//Console.WriteLine(s);
			//q.Dequeue();
			//#endregion
			//#region 查
			//if (q.Contains("miku"))
			//{
			//	Console.WriteLine("存在 miku");
			//}
			//else
			//{
			//	Console.WriteLine("不存在 miku");
			//}
			//#endregion
			//#region 遍历
			//foreach (object o in q)
			//{
			//	Console.WriteLine(o);
			//}
			//object[] arr = q.ToArray();
			//for (int i = 0; i < arr.Length; i++)
			//{
			//	Console.WriteLine(arr[i]);
			//}
			//#endregion
			//#region 请空
			//q.Clear();
			//#endregion
			//#region 拆箱装箱
			//int a = 10;
			//q.Enqueue(a);
			//a = (int)q.Dequeue();
			//#endregion

			//Queue q = new Queue(10);
			//Random r = new Random();
			//char[] ch = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
			//int idx;
			//StringBuilder s = new StringBuilder();
			//for (int i = 0; i < 10; i++)
			//{
			//	s.Clear();
			//	for (int j = 1; j <= 10 + r.Next(0, 11); j++)
			//	{
			//		idx = r.Next(0, ch.Length);
			//		s.Append(ch[idx]);
			//		if (j % 4 == 0)
			//		{
			//			s.Append(' ');
			//		}
			//	}
			//	s[0] = char.ToUpper(s[0]);
			//	s.Append(r.Next(0, 6) % 2 == 0 ? '.' : '?');
			//	q.Enqueue(s.ToString());
			//}
			//foreach (object o in q)
			//{
			//	System.Threading.Thread.Sleep(200 * r.Next(1, 11));
			//	Console.WriteLine(r.Next(0, 6) % 2 == 0 ? "muku>" : "洛天依>");
			//	Console.Write("\t");
			//	string str = o as string;
			//	for (int i = 0; i < str.Length; i++)
			//	{
			//		System.Threading.Thread.Sleep(100 * r.Next(1, 5));
			//		Console.Write(str[i]);
			//	}
			//	Console.WriteLine();
			//}
		}
	}
}
